package www.woniuxy.com.class112.service.impl;


import org.springframework.stereotype.Service;
import www.woniuxy.com.class112.dao.WorkOrderDetailsMapper;
import www.woniuxy.com.class112.dao.WorkOrdersMapper;
import www.woniuxy.com.class112.entity.WorkOrderDetails;
import www.woniuxy.com.class112.entity.WorkOrders;
import www.woniuxy.com.class112.param.specialEnvoySignInParam;
import www.woniuxy.com.class112.service.WorkOrderDetailsService;

import javax.annotation.Resource;
import java.util.Date;

@Service
public class WorkOrderDetailsServiceImpl implements WorkOrderDetailsService {
    @Resource
    private WorkOrdersMapper workOrdersMapper;
    @Override
    public void specialEnvoySignIn(specialEnvoySignInParam param) throws Exception {
        WorkOrders workOrders = workOrdersMapper.selectByPrimaryKey(param.getOrderId());
        if (workOrders.getAgentId().longValue()!=param.getAgentId()){
            throw new Exception("当前特派员与工单特派员不相同");
        }
        workOrders.setSignInDate(new Date());
        workOrdersMapper.updateByPrimaryKey(workOrders);
    }
}
